import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/views/HelloWorld'
import Login from '@/views/Login'
import Main from '@/views/Main'

import Users from '@/views/Users/Users'
import AddUser from '@/views/Users/AddUser'
import EditUser from '@/views/Users/EditUser'

import Systems from '@/views/Systems/Systems'
import AddSystem from '@/views/Systems/AddSystem'
import EditSystem from '@/views/Systems/EditSystem'

import Roles from '@/views/Roles/Roles'
import AddRole from '@/views/Roles/AddRole'
import EditRole from '@/views/Roles/EditRole'

import Permissions from '@/views/Permissions/Permissions'
import AddPermission from '@/views/Permissions/AddPermission'
import EditPermission from '@/views/Permissions/EditPermission'

import OrganizationalStructure from '@/views/OrganizationalStructure'
import RoleAuthorization from '@/views/RoleAuthorization'
import UserAuthorization from '@/views/UserAuthorization/UserAuthorization'
import BatchAddUserAuthorization from '@/views/UserAuthorization/BatchAddUserAuthorization'
import NotFoundPage from '@/views/NotFoundPage'
import ModifyPassword from '@/views/ModifyPassword'


Vue.use(Router)

export default new Router({
  routes: [{
      path: '/',
      name: 'Main',
      meta: {
        requireAuth: true, // 添加该字段，表示进入这个路由是需要登录的
      },
      component: Main,
      children: [{
          path: 'users',
          name: 'Users',
          component: Users
        },
        {
          path: 'users/add',
          name: 'AddUser',
          component: AddUser
        },
        {
          path: 'users/edit/:_id/:account/:username/:phonenum/:email',
          name: 'EditUser',
          component: EditUser,
          props: true
        },
        {
          path: 'systems',
          name: 'Systems',
          component: Systems
        },
        {
          path: 'systems/add',
          name: 'AddSystem',
          component: AddSystem
        },
        {
          path: 'systems/edit/:_id/:sysCode/:sysName',
          name: 'EditSystem',
          component: EditSystem,
          props: true
        },
        {
          path: 'roles',
          name: 'Roles',
          component: Roles
        },
        {
          path: 'roles/add/:sysId/:sysName',
          name: 'AddRole',
          component: AddRole,
          props: true
        },
        {
          path: 'roles/edit/:sysId/:roleId/:sysName/:roleCode/:roleName',
          name: 'EditRole',
          component: EditRole,
          props: true
        },
        {
          path: 'permissions',
          name: 'Permissions',
          component: Permissions
        },
        {
          path: 'permissions/add/:sysId/:sysName',
          name: 'AddPermission',
          component: AddPermission,
          props: true
        },
        {
          path: 'permissions/edit/:sysId/:permissionId/:permissionDescription/:permissionType/:permissionUrl',
          name: 'EditPermission',
          component: EditPermission,
          props: true
        },
        {
          path: 'organizational',
          component: OrganizationalStructure
        },
        {
          path: 'authorization/role',
          name: 'RoleAuthorization',
          component: RoleAuthorization
        },
        {
          path: 'authorization/user',
          name: 'UserAuthorization',
          component: UserAuthorization
        },
        {
          path: 'authorization/user/batchadd',
          name: 'BatchAddUserAuthorization',
          component: BatchAddUserAuthorization
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/modifyPassword',
      name: 'ModifyPassword',
      component: ModifyPassword
    },
    {
      path: '*',
      component: NotFoundPage
    }
  ]
})
